<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : joinFeedback-User.xsl
    Created on : June 11, 2013, 8:58 AM
    Author     : Hoang
    Description:
        Purpose of transformation follows.
-->


<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
    <xsl:param name="userXML"/>
    <xsl:variable name="user" select='document($userXML)'></xsl:variable>
    <!-- TODO customize transformation rules
         syntax recommendation http://www.w3.org/TR/xslt
    -->
    <xsl:template match="/">
        <feedbacks xmlns="http://xml.netbeans.org/schema/feedback-user">
            <xsl:for-each select="//feedback">
                <feedback>
                    <feedbackID>
                        <xsl:value-of select='feedbackID'/>
                    </feedbackID>
                    <userID>
                        <xsl:value-of select='userID'/>
                    </userID>
                    <xsl:variable name="currentId" select='userID'></xsl:variable>
                    <username>
                        <xsl:value-of select="$user/users/user[userId = $currentId]/username"/>
                    </username>
                    <title>
                        <xsl:value-of select='title'/>
                    </title>
                    <feedbackContent>
                        <xsl:value-of select='feedbackContent'/>
                    </feedbackContent>
                    <sendDate>
                        <xsl:value-of select='sendDate'/>
                    </sendDate>
                </feedback>
            </xsl:for-each>
        </feedbacks>
    </xsl:template>

   


</xsl:stylesheet>
